package com.shoulder.launcher.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
@Slf4j
public class LauncherInitializedListener implements ApplicationListener<WebServerInitializedEvent> {
    @Override
    public void onApplicationEvent(WebServerInitializedEvent event) {
        Environment environment = event.getApplicationContext().getEnvironment();
        int port = event.getWebServer().getPort();
        String appName = environment.getProperty("spring.application.name", "shoulder");
        String profile = environment.getProperty("spring.profiles.active", "default");
        log.info("项目 [{}] 启动完成，端口为:[{}]，环境变量:[{}]", appName, port, profile);
    }
}
